The basic structure of a memory cell of a magnetic memory, for example, a magnetoresistive random-access memory (MRAM), consists of a storage layer (magnetic layer), a reference layer (magnetic layer), and a nonmagnetic layer between the storage and reference layers. The reference layer comprises a material or a structure in which the magnetization direction is difficult to reverse in comparison with the storage layer. However, the magnetization direction of the reference layer may be reversed at the time of a write operation because of manufacturing tolerances.